class AdminController < ApplicationController
  before_filter :authorize_admin
  
  protected
  def authorize_admin
    if User.find_by_id(session[:user_id])
      user = User.find_by_id(session[:user_id])
      if user.level==3
        redirect_to students_index_url, :notice => "you can't access this page"
      elsif user.level==2
        redirect_to librarian_index_url, :notice => "you can't access this page"
      end
    end
  end
  public
  def index
  end
end
